﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

// -----------------------------------------------------------------------
// <copyright file="$safeitemrootname$.cs" company="$registeredorganization$">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------
namespace ObjectLibrary
{
    public class RotationPerspectiveCamera : PerspectiveCamera
    {
        private float _lookRotationY;

        public float LookRotationY
        {
            get { return _lookRotationY; }
            set { _lookRotationY = value; }
        }

        public override void UpdateCameraInfo(Fighter fighter)
        {
            base.UpdateCameraInfo(fighter);

            Vector3 pos = fighter.Position;
            pos.X += (float)(ZoomRate * Math.Cos(RotationY));
            pos.Z += (float)(ZoomRate * Math.Sin(RotationY));
            pos.Y += 0.5f * ZoomRate * (1 + (float)Math.Sin(-fighter.LookRotationZ));
            CameraPosition = pos;

            Vector3 posTarget = fighter.Position;
            posTarget.Y += 3 * LookRotationY;
            CameraTarget = posTarget;
        }
    }
}
